<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="/public/css/util.css">
    <link rel="stylesheet" href="/public/css/bootstrap.min.css">
    <link rel="stylesheet" href="/public/css/main.css">
    <title>文章详情页</title>
</head>

<body>
    <!-- header -->
    <header>
        <div class="center">
            <a class="head_logo" href="/">
                <img src="/public/image/logo.png" alt="" />
            </a>
            <nav class="head_nav">
                <a class="head_navCur" href="/">首页</a>
            </nav>
        </div>
    </header>
    <!-- center -->
    <div class="center">
        <div class="detail_main">
            <h2 class="detail_title">{{content.title}}</h2>
            <p class="detail_tag">日期：{{content.addTime | date('Y-m-d', -8*60)}} 阅读量：{{content.view}}</p>
            <input type="hidden" id="text-input" value="{{content.content}}">
            <div class="detail_content" id="preview"></div>
        </div>
    </div>
    <!-- discuss -->
    <div class="detail_discuss">
        <div class="detail_main">
            <div class="discuss">
                <div class="user_tab">
                    <span class="discuss_title">评论</span>
                </div>
                <div class="discuss_main">
                    <div class="discuss_content">
                        <ul class="discuss_list">

                        </ul>
                        {% if userInfo._id %}
                        <textarea class="discuss_input" name="" id="" cols="30" rows="10"
                            placeholder="请在这写下评论～"></textarea>
                        <input class="discuss_id" type="hidden" value="{{content._id.toString()}}">
                        <p class="discuss_submit">提 交</p>
                        {% else %}
                        <p class="discuss_default">您还没有登录，请先登录～</p>
                        {% endif %}
                    </div>
                </div>
            </div>
            <aside class="user_list">
                {% if userInfo._id %}
                <div class="user_logined">
                    {% if userInfo.isAdmin %}
                    <p class="user_welcome">欢迎，<i>{{userInfo.username}}</i><a href="/admin">进入后台</a></p>
                    {% else %}
                    <p class="user_welcome">欢迎，<i>{{userInfo.username}}</i></p>
                    {% endif %}
                    <span id="loginOut" class="user_loginOut">退出</span>
                </div>
                {% else %}
                <div class="user_form">
                    <div class="user_tab j_userTab">
                        <span class="user_cur">登录</span>
                        <span>注册</span>
                    </div>
                    <div id="login" class="user_login">
                        <div class="user_input">
                            <i class="iconfont">&#xe60d;</i>
                            <input type="text" placeholder="请输入用户名">
                        </div>
                        <div class="user_input margin_bottom0">
                            <i class="iconfont">&#xe6c6;</i>
                            <input type="password" placeholder="请输入密码">
                        </div>
                        <p class="user_err"><span>用户名不能为空</span></p>
                        <p class="user_login_btn">登 录</p>
                    </div>
                    <div id="register" class="user_register">
                        <div class="user_input">
                            <i class="iconfont">&#xe60d;</i>
                            <input type="text" placeholder="请输入用户名">
                        </div>
                        <div class="user_input">
                            <i class="iconfont">&#xe6c6;</i>
                            <input type="password" placeholder="请输入密码">
                        </div>
                        <div class="user_input margin_bottom0">
                            <i class="iconfont">&#xe6c6;</i>
                            <input type="password" placeholder="请再次输入密码">
                        </div>
                        <p class="user_err"><span>用户名不能为空</span></p>
                        <p class="user_register_btn">注 册</p>
                    </div>
                </div>
                {% endif %}

                <!-- <p class="user_no">您是本网站的第<i>12</i>位访客祝您生活工作愉快</p> -->
                <!-- <p class="copy_right">京ICP备17059284号-1</p> -->
            </aside>
        </div>
    </div>
    <!-- loading -->
    <!-- <div class="ajax-loading" id="ajaxLoading" style="display: none;">
        <div class="overlay"></div>
        <div class="loading">
            <img src="https://media.number-7.cn/ebike-h5/static/images/common/loading.gif" alt="">
            <span>加载中，请稍后...</span>
        </div>
    </div> -->
    <script src="/public/js/jquery-1.8.3.min.js"></script>
    <script src="/public/js/markdown.js"></script>
    <script src="/public/js/main.js"></script>
    <script>
        // 文章显示
        function Editor(input, preview) {
            this.update = function () {
                preview.innerHTML = markdown.toHTML(input.value);
            };
            input.editor = this;
            this.update();
        }
        var $$ = function (id) { return document.getElementById(id); };
        new Editor($$("text-input"), $$("preview"));
    </script>
</body>

</html>